import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class InputSelect extends StatelessWidget {
  final int index;
  final parent;
  final String choice;

  InputSelect(
      {@required this.index, @required this.parent, @required this.choice});

  @override
  Widget build(BuildContext context) {
    return Padding(
        padding: EdgeInsets.only(right: 10,top: 10),
        child: ChoiceChip(
            label: Text(choice),
            materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, //顶部是否有距离
            onSelected: (bool value) {
              if (value == true) {
                parent.onSelectedChanged(index);
              } else {
                parent.onSelectedChanged(-1);
              }
            },
            selected: parent.selected == index));
  }
}
